#include "CurrentVoltagePage.h"


void CurrentVoltagePage::paint() {
    if (focus) {
        super::paint();
    } else {
        mcurrentVoltageManager.updateInformation();

        std::string content[4];
        resetStream();
        strStream << "currentVoltage" << std::right << std::setw(2) << pageNum;// << std::setw(3)
        content[0] = strStream.str();
        size_t portNo;
        const CurrentVoltageInfo* pcurrentVoltageInfos;
        ICurrentVoltageDetectorPtr pExtendDevice;
        const size_t num = computePageItems(mportCount);
        for (size_t i = 0; i < num; ++i) {
            portNo = mmultiPageNo * PORT_COUNT_PER_PAGE + i;
            pExtendDevice = mcurrentVoltageManager.locateController(portNo);
            if (!pExtendDevice){
                continue;
            }
            pcurrentVoltageInfos = pExtendDevice->getCurrentVoltageInfos();

            resetStream();
            pcurrentVoltageInfos[portNo].toString(strStream);
            content[i + 1] =  strStream.str();
        }

        screen.show(&content[0], &content[1], &content[2], &content[3]);
    }
}



